package zhu.areas.match.service;

import java.util.List;

import zhu.areas.match.dao.IAttendListDAO;
import zhu.areas.match.dao.IMatchTypeDAO;
import zhu.areas.match.dao.ISponsorDAO;
import zhu.areas.match.data.AttendList;
import zhu.areas.match.data.MatchType;
import zhu.areas.match.data.Sponsor;

public class MatchServiceImpl implements IMatchService {

	private IMatchTypeDAO matchTypeDAO;
	private IAttendListDAO attendListDAO;
	private ISponsorDAO sponsorDAO;

	public List<MatchType> findAllMatchTypes() {
		return matchTypeDAO.findAllMatchTypes();
	}

	public String findMatchTypeById(int id) {
		return matchTypeDAO.findMatchTypeById(id);
	}

	public IMatchTypeDAO getMatchTypeDAO() {
		return matchTypeDAO;
	}

	public void setMatchTypeDAO(IMatchTypeDAO matchTypeDAO) {
		this.matchTypeDAO = matchTypeDAO;
	}

	public void saveAttendList(AttendList attendList) {
		this.attendListDAO.save(attendList);

	}

	public AttendList findAttendListById(Integer id) {

		return this.attendListDAO.findAttendListById(id);
	}

	public List<AttendList> findAllAttendList() {

		return this.attendListDAO.findAllAttendList();
	}

	public boolean checkAttendlist(int userId, int compId) {
		if (attendListDAO.findByUserAndCompId(userId, compId).size() > 0)
			return true;
		else
			return false;
	}

	public Sponsor findSponsorById(Integer id) {
		return sponsorDAO.findSponsorById(id);
	}

	public List<Sponsor> findSponsorByCompId(int compID) {		
		return sponsorDAO.findSponsorByCompId(compID);
	}

	public List<Sponsor> findAllSponsors() {
		return sponsorDAO.findAllSponsor();
	}

	public void saveSponsor(Sponsor sponsor) {
		sponsorDAO.save(sponsor);		
	}

	public List<Sponsor> findSponsorByCompId() {		
		return null;
	}
	public ISponsorDAO getSponsorDAO() {
		return sponsorDAO;
	}

	public void setSponsorDAO(ISponsorDAO sponsorDAO) {
		this.sponsorDAO = sponsorDAO;
	}
	public IAttendListDAO getAttendListDAO() {
		return attendListDAO;
	}

	public void setAttendListDAO(IAttendListDAO attendListDAO) {
		this.attendListDAO = attendListDAO;
	}

}
